package com.lucifer.core.exception;


import com.lucifer.core.Wrapper;
import com.lucifer.core.WrapperProvider;
import lombok.Data;

/**
 * Created by tangdaoyuan on 2017/1/13.
 */

@Data
public class ServiceException extends RuntimeException implements WrapperProvider {

    private Wrapper wrapper;

    public ServiceException(Wrapper wrapper) {
        this.wrapper = wrapper;
    }

    public ServiceException(Integer code, String msg) {
        this(Wrapper.builder().code(code).msg(msg).build());
    }

    @Override
    public Wrapper get() {
        return wrapper;
    }
}
